package org.jeecg.modules.health_records.health_livehabits.service.impl;

import org.jeecg.modules.health_records.health_livehabits.entity.HealthLiveHabitsInfo;
import org.jeecg.modules.health_records.health_livehabits.mapper.HealthLiveHabitsInfoMapper;
import org.jeecg.modules.health_records.health_livehabits.service.IHealthLiveHabitsInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: 生活方式与习惯信息表
 * @Author: jeecg-boot
 * @Date:   2025-06-30
 * @Version: V1.0
 */
@Service
public class HealthLiveHabitsInfoServiceImpl extends ServiceImpl<HealthLiveHabitsInfoMapper, HealthLiveHabitsInfo> implements IHealthLiveHabitsInfoService {
    @Autowired
    private HealthLiveHabitsInfoMapper healthLiveHabitsInfoMapper;
    /**按recordid查询**/
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthLiveHabitsInfo> queryByRecordId(HealthLiveHabitsInfo healthLiveHabitsInfo) {
        return healthLiveHabitsInfoMapper.queryByRecordId(Long.valueOf(healthLiveHabitsInfo.getRecordid()), healthLiveHabitsInfo.getIdNumber());

    }
    /**电子病历信息查询接口（查询时间最新的那条数据）--按recordid查询**/

    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthLiveHabitsInfo> queryElecRecord(HealthLiveHabitsInfo healthLiveHabitsInfo) {
        return healthLiveHabitsInfoMapper.queryElecRecord(Long.valueOf(healthLiveHabitsInfo.getRecordid()), healthLiveHabitsInfo.getIdNumber());

    }
}
